Certain modern programming languages such as the JAVA™ language and C# execute in a managed runtime environment (MRTE) that provides automatic memory management and dynamic loading facilities, among other features. MRTEs dynamically load and execute code that is delivered in a portable format. Thus, that code must be converted into native instructions via interpretation or compilation. Code and other related data may be loaded from disk, read from a network stream, or synthesized in memory by an application. Methods include bytecodes to specify what to do when the method is invoked. Such bytecodes are machine independent and at a higher abstraction level than native instructions. Thus the MRTE converts bytecodes into native instructions.
A JAVA™ Virtual Machine (JVM) is a software layer used to execute JAVA™ bytecodes. Such JVMs can suffer from poor performance, including costly overhead. One manner of avoiding such problems is using just-in-time (JIT) compilation to implement a JVM.
Through JIT compilation, a bytecode method is translated into a native method on the fly, which may desirably remove interpretation overhead. However the JIT compilation is part of the total execution time of a JAVA™ program.
Current JIT compilation and instruction set translation do not operate smoothly together. Each approach has a benefit and a penalty. The compilation process cannot provide the system a benefit until the code is executed using an interpreter and past history on the system and software behavior is collected. Instruction set translation cannot benefit system behavior as efficiently as a compiled process because reordering of instructions and code sequences cannot be done by what is essentially a “look up table.”
A need thus exists to provide for better cooperation between compilation and instruction set translation.